﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using System.Net.Mail;
using System.Text;

namespace GabageFactory.Models
{
    public class MaterialReposity : Reposity
    {

        public Phosphogypsum_Property GetMaterialById(int stackId)
        {
            var material = from p in _dataContext.Phosphogypsum_Properties
                           where stackId == p.stack_id
                       select p;

            if (material.Count() > 0)
            {
                return material.First();
            }
            else return null;
        }


        public Phosphogypsum_Property CreateMaterial(Phosphogypsum_Property material)
        {
            _dataContext.Phosphogypsum_Properties.InsertOnSubmit(material);
            SubmitChanges();
            return material;
        }

        public Phosphogypsum_Property EditMaterial(Phosphogypsum_Property material)
        {
            SubmitChanges();
            return material;
        }
    }
}